package com.ydl.shopping.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ydl.shopping.core.entity.BaseEntity;
import com.ydl.shopping.core.valid.ValidGroup;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotBlank;
import java.math.BigDecimal;

/** 订单表 */
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("tb_order")
@Schema(name = "订单表")
public class TbOrder extends BaseEntity {
    /** 用户编号 */
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    @TableField("user_id")
    @Schema(description = "用户编号")
    private Long userId;

    /** 订单编号 */
    @TableField("order_number")
    @NotBlank(groups = ValidGroup.Crud.Create.class, message = "订单编号不能为空")
    @NotBlank(groups = ValidGroup.Crud.Update.class, message = "订单编号不能为空")
    @Schema(description = "订单编号")
    private String orderNumber;

    /** 订单金额 */
    @TableField("price")
    @Schema(description = "订单金额")
    private BigDecimal price;

    /** 状态 */
    @TableField("status")
    @Schema(description = "状态")
    private Integer status;
}
